use ActionStatus;
use ActionResult;
use Operations;

package Action;

@ISA = qw/Component/;


our $accesor = sub{
    my $obj = shift;
    my ($attrname, $newval) = (shift, shift);

    if(defined($attrname) && defined($newval)){
	$obj->{$attrname} = $newval;
    }

    return $obj->{$attrname} if(defined($attrname));
    return "";
};


sub new{
    my $class = shift;
    my $self = {};

    bless $self, $class;
    $self->init(@_);

    $self->dependencies(qw/OperationManager LogManager/);
    return $self;
}

sub init{
    my $self = shift;
    my $params = shift;

    if(ref $params ne "HASH"){
	$params = {};
    }

    $self->{PARAMS} = $params;

    $self->dependencies("DependencyResolver");
}

sub perform{
    my $self = shift;
    return ActionResult->new("SUCCESS", "Done");
}

sub params{
    my $self = shift;
    my $newParams = shift;
    return  &$accesor($self, "PARAMS", $newParams);
}

1;
